<template>
  <div>
    <p class="title">{{ themeInfo.theme_name }}打分结果</p>

    <div class="container">
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column type="index" label="序号" width="80" />
        <el-table-column prop="per_name" label="姓名"> </el-table-column>
        <el-table-column prop="per_department" label="部门"> </el-table-column>

        <el-table-column prop="per_entry_date" label="入职时间" :formatter="dateFormat">
        </el-table-column>
        <!-- <el-table-column prop="per_age" label="年龄"> </el-table-column> -->
        <el-table-column prop="fr_fraction" label="分数"> </el-table-column>
        <el-table-column prop="fr_user_count" label="投票人"> </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import dayjs from 'dayjs'
export default {
  name: 'scoreList',
  data() {
    return {
      themeInfo: {},
      tableData: [],
    };
  },
  created() {
    this.getTheme();
    this.getScoreResult();
  },
  methods: {
    dateFormat(row,col,val,i) {
        return dayjs(val).format('YYYY-MM-DD')
    },
    async getTheme() {
      const res = await this.$Request({
        url: `/theme/detail/${this.$route.query.theme_id}`,
      });
      this.themeInfo = res.body;
    },
    async getScoreResult() {
      const res = await this.$Request({
        url: `/theme/fraction/result/${this.$route.query.theme_id}`,
      });
      this.tableData = res.body || [];
    },
    handleClick(row) {
      console.log(row);
      this.$router.push({
        //核心语句
        path: '/', //跳转的路径
        query: {
          //路由传参时push和query搭配使用 ，作用时传递参数
          id: row.name,
        },
      });
    },
  },
};
</script>

<style scoped>
.title {
  font-size: 20px;
  font-weight: bold;
  line-height: 2;
  text-align: left;
  margin-bottom: 20px;
  margin-top: 40px;
  margin-left: 40px;
}
.aTitle {
  text-align: left;
  line-height: 2;
  border: 1px solid rgba(222, 227, 231, 1);
  background-color: rgba(241, 249, 255, 1);
  padding-left: 15px;
}
.aTitle i {
  display: inline-block;
  width: 5px;
  height: 40px;
  position: relative;
  top: 8px;
  background-color: rgba(66, 164, 255, 1);
  margin-right: 10px;
}
.container {
  width: calc(100% - 80px);
  margin: 0 40px;
}
.btnContainer {
  text-align: center;
}
.btn {
  margin: 0 auto;
}
.search {
  width: 100px;
  height: 100px;
  text-align: center;
  line-height: 120px;
  background-color: #fff;
  border: 1px solid #999;
  z-index: 999;
  position: fixed;
  bottom: 60px;
  right: 60px;
}
.search i {
  font-size: 25px;
}
</style>
